<template>
	<view class="main-container">
		<uni-list>
			<uni-list-item v-for="(row,rowIndex) in tableDatas.datas" :title="'PO单号：'+row.SalesOrderNo"
				:note="handleNote(row)" @click="toPage(row)"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tableDatas: {
					dicID: 7924,
					datas: [],
					columns: [],
					formData: {},
					loading: false,
				},
			}
		},
		onLoad() {
			this.getApsData()
		},
		methods: {
			// 获取数据
			async getApsData(remark = 0) {
				const condition = {
					dicID: this.tableDatas.dicID,
				}
				// Object.assign(condition, this.tableDatas.formData)
				this.tableDatas.loading = true
				const res = await this.$request.post({
					url: '/APSAPI/APSData',
					data: condition
				}).catch(err => err)
				this.tableDatas.loading = false
				if (!res) return
				const {
					result,
					msg,
					data,
					Columns
				} = res
				if (!result) return uni.showToast({
					title: msg,
					icon: 'error'
				})
				this.$set(this.tableDatas, 'datas', data)
				this.$set(this.tableDatas, 'columns', Columns[0])
			},
			handleNote(row) {
				return `下单日期：${row.OrderDate}
				机台名称：${row.Extend3}
				组件数量：${row.C1}
				业务员：${row.SalesMan}
				生产状态：${row.ProductionStatusName}
				`
			},
			toPage(row) {
				let url = '/pages/Isgo/OrderInfo/OrderDetials'
				let params = {
					// OrderNo: row.OrderNo
					OrderDate: row.OrderDate,
					CustomerCode: row.CustomerCode,
					SalesOrderNo: row.SalesOrderNo,
					Qty: row.Qty,
					Extend3: row.Extend3,
					SalesMan: row.SalesMan,
					DeliveryDate: row.DeliveryDate,
					SalesOrderDetailID: row.SalesOrderDetailID,
				}
				this.$u.route({
					url,
					params
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	::v-deep .uni-list-item__content-title {
		background: linear-gradient(to right, rgb(184, 230, 236), #fff) !important;
		font-size: 36rpx;
		font-weight: bold;
	}

	::v-deep .uni-list-item__content-note {
		font-size: 30rpx;
	}
</style>